package cn.ahaiahaixx.dp.thread;

import java.io.InputStream;
import java.net.URL;
import java.net.URLConnection;
import java.util.Scanner;

public class UrlDemo {
  public static void main(String[] args) throws Exception {
    String url = "http://ahaiahaixx.cn";
    // 打开url的连接
//    URLConnection connection = new URL(url).openConnection();
//    InputStream is = connection.getInputStream();
//    Scanner scanner = new Scanner(is);
//    while (scanner.hasNext()) {
//      System.out.println(scanner.nextLine());
//    }
//    scanner.close();
//    is.close();
    int count=100;
    for (int i = 0; i < count; i++) {
      new Thread(new UrlRunnable(url)).start();
    }
    System.out.println("开始多线程url访问");
  }

}
